package com.sumainfor.pc.gmio.controller.housekeeper;

import com.sumainfor.common.util.JsonResult;
import com.sumainfor.pc.gmio.service.HoTenantBlaService;
import com.sumainfor.pc.gmio.service.HoWithdrawalService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.io.Serializable;
import java.util.Map;

/**
 *服务管家退租账单
 */
@RestController
@RequestMapping("/housekeeper/HoWithdrawal")
public class HoWithdrawalController implements Serializable {
    @Autowired
    private HoWithdrawalService hoWithdrawalService;
    /**
     *服务管家查询合同期间是否有人退租
     */
    @GetMapping("/getHoWithdrawalList")
    public JsonResult getHoWaterMeterLast(@RequestParam Map<String,Object> params){
        JsonResult result=new JsonResult();
        return result.put(hoWithdrawalService.getHoWithdrawalList(params));
    }
    /**
     *服务管家退租生成退租结算单
     */
    @PostMapping("/addHoWithdrawal")
    public JsonResult addHoWithdrawal(@RequestBody Map<String,Object> params){
        return hoWithdrawalService.addHoWithdrawal(params);
    }
    /**
     * 服务管家根据房源退租主表编号查询房源的退租信息
     */
    @GetMapping("/getHoWithdrawalByWitId")
    public JsonResult getHoWithdrawalByWitId(@RequestParam Map<String,Object> params){
        JsonResult result=new JsonResult();
        if (params.get("WitId")==null){
           return result.putFailed("参数不正确");
        }
        Map<String,Object> map=hoWithdrawalService.getHoWithdrawalByWitId(params);
        if (map!=null){
            result.put(map);
        }else{
            result.putFailed("服务器繁忙");
        }
        return result;
    }
    /**
     * 租后主管查看退租账单详情
     */
    @GetMapping("/getHoWithdrawal")
    public JsonResult getHoWithdrawal(@RequestParam Map<String,Object> params){
        JsonResult result=new JsonResult();
        Map<String,Object> map=hoWithdrawalService.getHoWithdrawal(params);
        if (map!=null){
            result.put(map);
        }else{
            result.putFailed("服务器繁忙");
        }
        return result;
    }
    /**
     *租后主管查询员工信息列表（服务管家和服务描述）
     */
    @GetMapping("/getHokeeperStaffList")
    public JsonResult getHokeeperStaffList(@RequestParam Map<String,Object> params){
        return hoWithdrawalService.getHokeeperStaffList(params);
    }
    /**
     *租后主管账单管理（常规退租客和违约退租客）
     */
    @GetMapping("/getHoWithdList")
    public JsonResult getHoWithdList(@RequestParam Map<String,Object> params){
        return hoWithdrawalService.getHoWithdList(params);
    }
    /**
     * 根据合同编号查询该合同是否存在未审核的退租表
     */
    @GetMapping("/getHoPactWithCount")
    public JsonResult getHoPactWithCount(@RequestParam Map<String,Object> params){
        return hoWithdrawalService.getHoPactWithCount(params);
    }

}
